/*
 * Copyright (C) 2010-2011 Comcast Cable.  All Rights Reserved.
 */
package com.hercules.android.receiver.model.objects;

import java.util.LinkedHashMap;
import java.util.Map;

/**
 * <p>
 * This class represents both the top-level XRE application and an XRE application loaded within an XRE application. It
 * is a simple JavaBean (POJO) that provides getters and setters for all private attributes and performs no argument
 * validation in the setters.
 * </p>
 * <p>
 * <strong>Thread safety:</strong> This class is mutable and not thread safe.
 * </p>
 *
 * @author saarixx, jmn
 * @author 7realm
 * @version 1.0
 */
public class XREApplication extends XREResource {

    /**
     * <p>
     * The XRE URI of the application, in the form xre://[host]:[port]/[application].
     * </p>
     * <p>
     * Can be any value.
     * </p>
     * <p>
     * Has getter and setter.
     * </p>
     * <p>
     * AndroidAssembly1 changed uri to url
     */
    private String url;

    /**
     * <p>
     * The minimum desired version of the application.
     * </p>
     * <p>
     * Can be any value.
     * </p>
     * <p>
     * Has getter and setter.
     * </p>
     */
    private String minimumVersion;

    /**
     * <p>
     * The optional hash map of parameters to send to new application. Keys are parameter names.
     * </p>
     * <p>
     * Can be any value, can contain any values.
     * </p>
     * <p>
     * Has getter and setter.
     * </p>
     */
    private Map<String, Object> launchParams = new LinkedHashMap<String, Object>();

    /**
     * <p>
     * The optional GUID identifying the session to use for this application. This can be provided by the host at
     * application launch time to manage application sessions.
     * </p>
     * <p>
     * Can be any value.
     * </p>
     * <p>
     * Has getter and setter.
     * </p>
     */
    private String sessionGUID;

    /**
     * <p>
     * Creates new instance of {@link XREApplication} class.
     * </p>
     */
    public XREApplication() {
        // empty constructor
    }

    /**
     * <p>
     * Retrieves the XRE URI of the application, in the form xre://[host]:[port]/[application].
     * </p>
     *
     * @return the XRE URI of the application, in the form xre://[host]:[port]/[application]
     */
    public String getUrl() {
        return url;
    }

    /**
     * <p>
     * Sets the XRE URI of the application, in the form xre://[host]:[port]/[application].
     * </p>
     *
     * @param url the XRE URI of the application, in the form xre://[host]:[port]/[application]
     */
    public void setUrl(String url) {
        this.url = url;
    }

    /**
     * <p>
     * Retrieves the minimum desired version of the application.
     * </p>
     *
     * @return the minimum desired version of the application
     */
    public String getMinimumVersion() {
        return minimumVersion;
    }

    /**
     * <p>
     * Sets the minimum desired version of the application.
     * </p>
     *
     * @param minimumVersion the minimum desired version of the application
     */
    public void setMinimumVersion(String minimumVersion) {
        this.minimumVersion = minimumVersion;
    }

    /**
     * <p>
     * Retrieves the optional hash map of parameters to send to new application.
     * </p>
     *
     * @return the optional hash map of parameters to send to new application
     */
    public Map<String, Object> getLaunchParams() {
        return launchParams;
    }

    /**
     * <p>
     * Sets the optional hash map of parameters to send to new application.
     * </p>
     *
     * @param launchParams the optional hash map of parameters to send to new application
     */
    public void setLaunchParams(Map<String, Object> launchParams) {
        this.launchParams = launchParams;
    }

    /**
     * <p>
     * Retrieves the optional GUID identifying the session to use for this application.
     * </p>
     *
     * @return the optional GUID identifying the session to use for this application
     */
    public String getSessionGUID() {
        return sessionGUID;
    }

    /**
     * <p>
     * Sets the optional GUID identifying the session to use for this application.
     * </p>
     *
     * @param sessionGUID the optional GUID identifying the session to use for this application
     */
    public void setSessionGUID(String sessionGUID) {
        this.sessionGUID = sessionGUID;
    }
}
